<?php

namespace App;

use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;

class User extends Authenticatable
{
    use Notifiable;

    protected $table = 'user';

    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [
        'status',
    ];

    /**
     * The attributes that should be hidden for arrays.
     *
     * @var array
     */
    protected $hidden = [
        'password', 'remember_token',
    ];

    public function getJBAttribute()
    {
        return UserCoin::totalJb($this->id);
    }

    public function getZSAttribute()
    {
        return UserCoin::totalZs($this->id);
    }

    public function getXYXAttribute()
    {
        return UserCoin::totalXyx($this->id);
    }
    
    public function changes()
    {
        return $this->hasMany('App\UserChange');
    }

    public function orders()
    {
        return $this->hasMany('App\Order');
    }
    
    public function pointcardQueue(){
        return $this->hasMany('App\PointCardQueue');
    }
    
}
